package com.ruoyi.system.mapper;

import com.ruoyi.system.domain.Comment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface CommentMapper {

    int saveComment(Comment comment);

    void deleteComment(Long id);

    List<Comment> findByparentCommentId(
            @Param("parentCommentId") Long parentCommentId);

    List<Comment> findByBlogIdParentIdNull(
            @Param("blogId") Long blogId, @Param("blogParentId") Long blogParentId);

    List<Comment> findByBlogIdParentIdNotNull(
            @Param("blogId") Long blogId, @Param("id") Long id);

    List<Comment> findByBlogIdAndReplayId(
            @Param("blogId") Long blogId,@Param("childId") Long childId);

    List<Comment> findByUserIdParentIdNull(
            @Param("userId") Long userId, @Param("blogParentId") Long blogParentId);

    List<Comment> findByUserIdParentIdNotNull(
            @Param("userId") Long userId, @Param("id") Long id);

    List<Comment> findByUserIdAndReplayId(
            @Param("userId") Long userId,@Param("childId") Long childId);
}
